package org.example.spring_boot_blog.common.utils;

import org.example.spring_boot_blog.common.pojo.dataobject.BlogInfo;
import org.example.spring_boot_blog.common.pojo.dataobject.UserInfo;
import org.example.spring_boot_blog.common.pojo.response.BlogInfoResponse;
import org.example.spring_boot_blog.common.pojo.response.UserInfoResponse;
import org.springframework.beans.BeanUtils;

public class BeanConver {
    public static BlogInfoResponse trans(BlogInfo blogInfo){
        BlogInfoResponse blogInfoResponse = new BlogInfoResponse();
        if(blogInfo!=null){
            BeanUtils.copyProperties(blogInfo, blogInfoResponse);
        }
        return blogInfoResponse;
    }
    public static UserInfoResponse trans(UserInfo userInfo){
        UserInfoResponse userInfoResponse = new UserInfoResponse();
        if(userInfo!=null){
            BeanUtils.copyProperties(userInfo, userInfoResponse);
        }
        return userInfoResponse;
    }
}
